package com.jk.garden1.service;

import com.jk.garden1.dao.NoteDao;
import com.jk.garden1.entity.NoteEntity;
import io.netty.util.Timeout;
import io.netty.util.TimerTask;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.TaskScheduler;
import org.springframework.scheduling.support.PeriodicTrigger;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;
import java.util.Timer;
import java.util.concurrent.TimeUnit;


@Service
public class NoteService {
    @Autowired
    private NoteDao noteDao;

    @Autowired
    private TaskScheduler taskScheduler;

    /**
     * 查询全部
     */
    public List<NoteEntity> selectNoteList() {
        return noteDao.selectList(null);
    }
    /**
     * mybatis-plays删除全部
     */
    public void delAll() {
        noteDao.delete(null);
    }

//    public static void main(String[] args) {
//        //创建定时器
//        Timer timer = new Timer();
//        //创建定时器任务
//        TimerTask timerTask = new TimerTask() {
//            @Override
//            public void run(Timeout timeout) throws Exception {
////                noteDao.delete(null);
//                System.out.println("111111111111");
//            }
//        };
//        timer.scheduleAtFixedRate(task,new Date(),4000);
//   }


}
